<?php
 
	$item_id = $params[2];
	if($_SERVER["REQUEST_METHOD"]=='POST') {
		$color_id	= strip_tags($_POST['color_id']);
		$size_id	= strip_tags($_POST['size_id']);
		$count		= strip_tags($_POST['count']);

		$sql = "UPDATE `tbl_product_item` SET `color_id` = '$color_id' , `size_id` = '$size_id' , `count` = '$count' , `update` = NOW()  WHERE `item_id` = '$item_id' LIMIT 1;";
		 
		mysql_query($sql);
	 	redirect('../');
		exit;
	}
	$sql = "SELECT * FROM `tbl_product_item`  WHERE  `item_id` = '$item_id' LIMIT 1";
	$query = mysql_query($sql);
	while($result = mysql_fetch_assoc($query)) {
		$product_id	= $result['product_id'];
		$color_id	= $result['color_id'];
		$size_id	= $result['size_id'];
		$count		= $result['count'];
	}
	mysql_free_result($query);
	
	$colorOptions	= _u(sqlOptions("SELECT `title` AS `label`, `color_id` AS `value` FROM `tbl_color` WHERE `product_id` = '$product_id' ORDER BY `color_id` ASC",$color_id),'color');
	$sizeOptions	= _u(sqlOptions("SELECT `title` AS `label`, `size_id` AS `value` FROM `tbl_size` WHERE 1 ORDER BY `size_id` ASC",$size_id),'size');
?>